package cn.sc.summer.core.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 枚举类型：任务行为枚举类
 *
 * @author a-xin
 * @date 10:38
 */
@Getter
@AllArgsConstructor
public enum JavaTypeEnum {

    BYTE("1", Byte.class),
    SHORT("2", Short.class),
    INT("3", Integer.class),
    LONG("4", Long.class),
    FLOAT("5", Float.class),
    DOUBLE("6", Double.class),
    CHAR("7", Character.class),
    BOOLEAN("8", Boolean.class),
    STRING("9", String.class),
    ;

    private final String type;
    private final Class<?> clazz;

    public static JavaTypeEnum getByType(String type) {
        if (StrUtil.isBlank(type)) {
            return null;
        }
        for (JavaTypeEnum enums : JavaTypeEnum.values()) {
            if (enums.type.equals(type)) {
                return enums;
            }
        }
        return null;
    }

}
